@extends('home.parent')
@section('title','新增合伙人')
@section('head_js')
@endsection
@section('head_css')
<link rel="stylesheet" href="{{ asset('/css/select2/select2.min.css') }}">
<link rel="stylesheet" href="{{ asset('/css/datepicker3.css') }}">
@endsection
@section('content')
<div class="content-wrapper">
<section class="content-header">
	<h1>新增合伙人<small></small></h1>
	<ol class="breadcrumb">
		<li><a href="{{URL('admin')}}"><i class="fa fa-dashboard"></i> 首页</a></li>
		<li><a href="{{URL('admin/partner/list')}}">合伙人列表</a></li>
		<li class="active">新增合伙人</li>
	</ol>
</section>
<style>
	form div input[type="password"],form div input[type="text"],select[name="industry_id"],select[name="gender"],select[name="pay_type"]{width:280px;color:#717171;}
	form div label{padding: 7px 15px 0 0;text-align:right;color:#717171;}
	form div button{margin-right:10px;}
	form div.ca_number{display:none;}
	
	form div.box-body label{width:100px;}
	form div input.form-control,form div select.form-control{display:inline;}
	#data_form span.fa{top:10px;left:390px;margin-left:-18px;position:absolute;cursor:pointer;color:#009688;}
	@media screen and (max-width: 465px) {
		#data_form span.fa{top:41px;left:290px;margin-left:-18px;position:absolute;cursor:pointer;color:#009688;}
	}
</style>
<section class="content">
	<div class="row">
		<div class="col-md-12">
			<!--general form elements-->
			<div class="box box-primary">
				<form id="data_form">
					<div class="box-body">
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">登录用户名
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="user_name" autocomplete="off" placeholder="5-11位 字母、数字、下划线" maxlength="11">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<span class="fa fa-eye showPwd"></span>
							<label class="control-label">登录密码
								<span style="color: red">*</span>
							</label>
							<input type="password" class="form-control" name="pwd" autocomplete="off"	placeholder="6-16位 字母、数字、下划线" maxlength="16">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">所在地
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="city" placeholder="请输入所在地" maxlength="20">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">机构
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="company" placeholder="请输入合伙人机构" maxlength="20">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">具体地址
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="address" placeholder="请输入具体地址" maxlength="200">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">联系人
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="name" placeholder="请输入合伙联系人" maxlength="8">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">手机号
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="mobile" placeholder="请输联系人手机号" maxlength="11">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">性别</label>
							<select class="form-control" name="gender">
								<option value="0">--请选择--</option>
								<option value="1">男</option>
								<option value="2">女</option>
							</select>
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">微信</label>
							<input type="text" class="form-control" name="wechat" placeholder="请输入联系人微信号" maxlength="16">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">邮箱</label>
							<input type="text" class="form-control" name="email" placeholder="请输入联系人邮箱" maxlength="100">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">倍数
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="discount" placeholder="小于等于100的数值，最多一位小数" maxlength="5">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">开户金额
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="first_price" placeholder="请输入不以0开头的整数" maxlength="10">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">支付方式
								<span style="color: red">*</span>
							</label>
							<select class="form-control" name="pay_type">
								<option value="0">--请选择--</option>
								@if(!empty(Config('basics.pay_type')))@foreach(Config('basics.pay_type') as $k => $v)
								<option value="{{ $k }}">
									{{ $v }}
								</option>
								@endforeach @endif
							</select>
						</div>
						<div class="form-group col-lg-6 col-md-12 ca_number">
							<label class="control-label">对公账户号
								<span style="color: red">*</span>
							</label>
							<input type="text" class="form-control" name="ca_number" placeholder="请输入对公账户号" maxlength="30">
						</div>
						<div class="form-group col-lg-6 col-md-12">
							<label class="control-label">备注</label>
							<input type="text" class="form-control" name="remark" placeholder="备注">
						</div>
					</div>
					<!--/.box-body-->
					<div class="box-footer">
						<label class="col-sm-1 control-label"></label>
						<button type="button" class="btn btn-info data_form">提 交</button>
						<button type="reset" class="btn btn-default">重 置</button>
						<button type="button" class="btn btn-default" onclick="history.go(-1)">取 消</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</section>
</div>
@endsection
@section('foot_js')
<script src="{{ asset('/js/apk.js') }}"></script>
<script src="{{ asset('/js/tools.js') }}"></script>
<!--<script src="{{ asset('/css/select2/select2.full.min.js') }}"></script>-->
<script src="{{ asset('/js/bootstrap-datepicker.js') }}"></script>
<script>
$(document).ready(function(){
	// $(".select2").select2();     select 搜索框
	$('input[name="start_date"]').datepicker({
		startDate: "{{date('Y-m-d',time())}}",
		todayHighlight: true,
		language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
	});
	$('input[name="end_date"]').datepicker({
		startDate: "{{date('Y-m-d',time()+24*3600)}}",
		todayHighlight: true,
		language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		format: "yyyy-mm-dd"//日期格式，详见 http://bootstrap-datepicker.readthedocs.org/en/release/options.html#format
	});
})
$('select[name="pay_type"]').change(function(){
	if($(this).val()==4){
		$('#data_form div.ca_number').show();
	}else{
		$('#data_form div.ca_number').hide();
	}
});
$('#data_form button.data_form').click(function(){
	// puppet.mesWarn('开户金额有误！请输入大于0的值');
	var data=$('#data_form').serialize();
	var url = "{{URL('admin/partner/create/save')}}";
	var result = puppet.myajax('post',url,data,false);
	if(result.code == 1){
		layer.msg(result.msg,{icon:2});
		return false;
	}else{
		layer.msg(result.msg,{icon:1});
		setInterval(function(){
			window.location.href=result.url;
		},"2000");
	}
});
//查看密码
$('.showPwd').hover(function(){
	$(this).removeClass('fa-eye');
	$(this).addClass('fa-eye-slash');
	$(this).parent().children('input').attr('type','text');
},function(){
	$(this).removeClass('fa-eye-slash');
	$(this).addClass('fa-eye');
	$(this).parent().children('input').attr('type','password');
});
</script>
@endsection